package com.first.module.acm.dao.impl;

import java.util.ArrayList;
import java.util.List;

import com.first.core.dao.impl.BaseDaoImpl;
import com.first.module.acm.dao.UserSubDao;
import com.first.module.acm.model.UserSub;

public class UserSubDaoImpl extends BaseDaoImpl<UserSub>
  implements UserSubDao
{
  public UserSubDaoImpl()
  {
    super(UserSub.class);
  }

  public List<String> upUser(String userId)
  {
    String hql = "from UserSub vo where vo.subAppUser.userId=?";
    Object[] objs = { userId };
    List<UserSub> list = findByHql(hql, objs);
    List idList = new ArrayList();
    for (UserSub sb : list) {
      idList.add(sb.getUserId());
    }
    return idList;
  }

  public List<String> subUsers(String userId)
  {
    String hql = "from UserSub vo where vo.userId=?";
    Object[] objs = { userId };
    List<UserSub> list = findByHql(hql, objs);
    List idList = new ArrayList();
    for (UserSub sb : list) {
      idList.add(sb.getSubAppUser().getUserId());
    }
    return idList;
  }
}

